package com.nbot.server.algorithm;

/**
 * 趋势及速率判断
 * 数据多时也可以判断总体趋势，inTemp、deTemp调整，同时加入总的趋势速率
 * wyzc 180618
 * 速率需要时间序列，待添加
 */

public class TrendJudgeImpl {

    public String trendResult(float[] data){

        int inTemp = 0;
        int deTemp = 0;
        String result;

        for (int i=0;i<data.length-1;i++){
            if (data[i] <= data[i+1]){
                inTemp += 0;
            }else{
                inTemp += 1;
            }
        }

        for (int i=0;i<data.length-1;i++){
            if (data[i] >= data[i+1]){
                deTemp += 0;
            }else{
                deTemp += 1;
            }
        }

        if (inTemp == 0 && deTemp==0){
            result = "same";
        } else if (inTemp == 0){
            result = "increase";
        } else if (deTemp == 0){
            result = "decrease";
        } else {
            result = "wave";
        }

        return result;
    }
}